<?php
namespace app\common\model;

use think\Model;

class BisLocation extends BaseModel   //model层 数据添加到数据库
{
     
   public function getNormalLocationByBisId($bisId){
	   $data = [
	       'bis_id' => $bisId,
		   'status' => 1,
	   
	   ];
	   
	   $result = $this->where($data)->order('id', 'desc')->select();
	   return $result;
	   
	   
	   } 
      public function getLocationsByBisId($bisId){
	   $data = [
	       'bis_id' => $bisId,
		   'status' => ['gt',-1],
	   
	   ];
	   $order = [
	       
		   'status' => 'asc',
		   'id' => 'desc',
	   
	   ];
	   
	   $result = $this->where($data)->order($order)->select();
	   return $result;
	   
	   
	   }  


public function getNormalLocationsInId($ids){
	$data = [
	    'id' => ['in', $ids],
		'status' => 1,
	
	];
	
	return $this->where($data)->select();
	
	}

public function updateBuyCountById($id, $buyCount){
	return $this->where(['id'=>$id]->setInc('buy_count', $buyCount));
	
	}









}